<%-- 
    Document   : incluir
    Created on : 24/08/2009, 15:22:05
    Author     : leidson
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="javacademic.pessoa.Pessoa" %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Pessoas</title>
    </head>

    <% Pessoa p = (Pessoa) request.getAttribute("pessoa"); %>
    <body>
        <h1>Cadastro de Pessoas</h1>
        <br />
        <% if (p == null) { %>
        <form method="post" action="IncluirPessoaServlet">
        <% } else { %>
        <form method="post" action="AlterarPessoaServlet">
        <% } %>
            <table>
                <% if (p != null) { %>
                <tr>
                    <td>Código:</td>
                    <td><input readonly name="codigo" type ="text" value="<%= p.getCodigo() %>" /></td>
                </tr>
                <% } %>
                <tr>
                    <td>Nome:</td>
                    <td><input name="nome" type ="text" value="<%= ((p != null) ? p.getNome() : "") %>" /></td>
                </tr>
                <tr>
                    <td>Endereço:</td>
                    <td><input name="endereco" type ="text" value="<%= ((p != null) ? p.getEndereco() : "") %>" /></td>
                </tr>
                <tr>
                    <td>E-mail:</td>
                    <td><input name="email" type ="text" value="<%= ((p != null) ? p.getEmail() : "") %>" /></td>
                </tr>
            </table>
            <table>
                <tr>
                    <td><input type="submit" value="Salvar"/></td>
                    <td><a href="ListarPessoaServlet">Cancelar</a></td>
                </tr>
            </table>
        </form>
    </body>
</html>
